package com.spirit.mypopup.menu;

import android.os.Parcel;

import java.util.List;

/**
 * author : fang.zhang
 * e-mail : initzf@126.com
 * date   : 2020/5/16
 * desc   :
 */
public class CityBean implements OptionDoubleObj {

    private String title;
    private int id;
    private List<CityBean> child;

    public CityBean(String title, int id, List<CityBean> child) {
        this.title = title;
        this.id = id;
        this.child = child;
    }

    public CityBean(String title, int id) {
        this.title = title;
        this.id = id;
    }


    @Override
    public String getTitle() {
        return title;
    }

    @Override
    public String getId() {
        return "" + id;
    }

    @Override
    public List<? extends OptionObject> getChildList() {
        return child;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.title);
        dest.writeInt(this.id);
        dest.writeTypedList(this.child);
    }

    protected CityBean(Parcel in) {
        this.title = in.readString();
        this.id = in.readInt();
        this.child = in.createTypedArrayList(CityBean.CREATOR);
    }

    public static final Creator<CityBean> CREATOR = new Creator<CityBean>() {
        @Override
        public CityBean createFromParcel(Parcel source) {
            return new CityBean(source);
        }

        @Override
        public CityBean[] newArray(int size) {
            return new CityBean[size];
        }
    };
}
